package com.first.service.impl;

import com.first.dao.BOrderDao;
import com.first.dao.BOrderWjDao;
import com.first.entity.BOrder;
import com.first.entity.BOrderWj;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Repository
public class OrderServiceImpl implements com.first.service.OrderService {

    @Resource
    private BOrderDao bOrderDao;
    @Resource
    private BOrderWjDao bOrderWjDao;

    /**
     * 查询订单详情根据orderid
     *
     * @param bOrder
     * @return
     */
    @Override
    public List<Map> getBOrderById(BOrder bOrder) {
        return bOrderDao.getBOrderById(bOrder);
    }

    /**
     * 查询全部
     *
     * @param bOrder
     * @return
     */
    @Override
    public List<Map> getAllBOrder(BOrder bOrder) {
        return bOrderDao.getAllBOrder(bOrder);
    }

    /**
     * 获得订单数量
     *
     * @param bOrder
     * @return
     */
    @Override
    public int getAllBOrderCount(BOrder bOrder) {
        return bOrderDao.getAllBOrderCount(bOrder);
    }

    @Override
    public double updateCOunt1(BOrderWj bOrderWj) {
        return bOrderDao.updateCOunt1(bOrderWj);
    }

    @Override
    public int updateBCount(BOrder bOrder) {
        return bOrderDao.updateBCount(bOrder);
    }


    /**
     * 新增
     *
     * @param bOrder
     * @return
     */
    @Override
    public int addOrder(BOrder bOrder) {
        return bOrderDao.addOrder(bOrder);
    }


    /**
     * 通过主键的删除
     *
     * @param id
     * @return
     */
    @Override
    public int deleteById(Integer id) {
        return bOrderDao.deleteById(id);
    }

    /**
     * 查询历史订单
     *
     * @param bOrder
     * @return
     */
    @Override
    public List<Map> getHOrder(BOrder bOrder) {
        return bOrderDao.getHOrder(bOrder);
    }

    /**
     * 获得历史订单数量
     *
     * @param bOrder
     * @return
     */
    @Override
    public int getHBOrderCount(BOrder bOrder) {
        return bOrderDao.getHBOrderCount(bOrder);
    }

    /**
     * 显示订单未审核的表
     * Failed=未审核
     *
     * @param bOrder@return
     */
    @Override
    public List<Map> getFailedOrder(BOrder bOrder) {
        return bOrderDao.getFailedOrder(bOrder);
    }

    /**
     * 获取未审核查询结果个数
     *
     * @param bOrder
     * @return
     */
    @Override
    public int getFailedOrderCount(BOrder bOrder) {
        return bOrderDao.getFailedOrderCount(bOrder);
    }

    /**
     * 将订单状态改为通过
     *
     * @param order
     * @return
     */
    @Override
    public int updateStatus(BOrder order) {
        return bOrderDao.updateStatus(order);
    }

    @Override
    public int updateStatus3(BOrder order) {
        return bOrderDao.updateStatus3(order);
    }

    /**
     * 将驳回订单再次提交
     *
     * @param order
     * @return
     */
    @Override
    public int updateStatus0(BOrder order) {
        return bOrderDao.updateStatus0(order);
    }

    /**
     * 获取订单详细信息
     *
     * @param bOrderWj
     * @return
     */
    @Override
    public List<Map> getAllBOrderWj(BOrderWj bOrderWj) {
        return bOrderWjDao.getAllBOrderWj(bOrderWj);
    }

    /**
     * 新增订单信息详细信息
     *
     * @param bOrderWj
     * @return
     */
    @Override
    public double addOrderWj(BOrderWj bOrderWj) {
        return bOrderWjDao.addOrderWj(bOrderWj);
    }

    /**
     * 将订单设为驳回状态
     * status=2
     *
     * @param bOrder
     * @return
     */
    @Override
    public int setStatus2(BOrder bOrder) {
        return bOrderDao.setStatus2(bOrder);
    }

    /**
     * 修改驳回订单的数据
     *
     * @param bOrderWj
     * @return
     */
    @Override
    public int updateReject(BOrderWj bOrderWj) {
        return bOrderDao.updateReject(bOrderWj);
    }

    /**
     * 修改驳回状态的订单表数量
     *
     * @param bOrder
     * @return
     */
    @Override
    public int updateCount(BOrder bOrder) {
        return bOrderDao.updateCount(bOrder);
    }

    /**
     * 查看所有驳回订单
     *
     * @param bOrder
     * @return
     */
    @Override
    public List<Map> queryReject(BOrder bOrder) {
        return bOrderDao.queryReject(bOrder);
    }

    /**
     * 查看所有驳回订单的数据数量
     *
     * @param bOrder
     * @return
     */
    @Override
    public int rejectCount(BOrder bOrder) {
        return bOrderDao.rejectCount(bOrder);
    }

    /**
     * 将订单全部执行，入库，并且将订单中的数量放入仓库
     * 状态为4代表入科
     *
     * @param order
     * @return
     */
    @Override
    public int updateStatus4(BOrder order) {
        return bOrderDao.updateStatus4(order);
    }

    /**
     * 查询历史订单 状态为4
     *
     * @param bOrder
     * @return
     */
    @Override
    public List<Map> getAllBOrder4(BOrder bOrder) {
        return bOrderDao.getAllBOrder4(bOrder);
    }

    /**
     * 查询入库书籍的信息的数量
     * @param bOrder
     * @return
     */
    @Override
    public int getAllBOrderCount4(BOrder bOrder) {
        return bOrderDao.getAllBOrderCount4(bOrder);
    }
}
